﻿using ATM.BUS;
using ATM.DAO;
using ATM.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ATMSystem
{
    public partial class frmWithdrawOther : Form
    {
        private frmAskForReceipt frm1;
        private Account passedAcc = null;
        private Card passedCard = null;

        public frmWithdrawOther()
        {
            InitializeComponent();
        }

        public frmWithdrawOther(Account acc, Card card)
        {
            InitializeComponent();
            passedAcc = acc;
            passedCard = card;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            switch (WithdrawBUS.Withdraw(float.Parse(txtMoney.Text), passedAcc, passedCard, 1))
            {
                case 0:
                    MessageBox.Show("The inserted amount is not valid!");
                    break;
                case 1:
                    MessageBox.Show("Amount is out of your withdraw limit!");
                    break;
                case 4:
                    MessageBox.Show("Can't withdraw!");
                    break;
                default:
                    frm1 = new frmAskForReceipt();
                    frm1.Show();
                    break;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {

        }
    }
}
